package com.czl.module_service.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.czl.base.binding.command.BindingCommand
import com.czl.base.binding.command.BindingConsumer
import com.czl.base.data.bean.tengyun.StorehouseBean
import com.czl.module_service.R
import com.czl.module_service.databinding.ItemStoreManageBinding

/**
 * @author by xubin,
 * @date on 2022/1/17.
 * PS: Not easy to write code, please indicate.
 */
class StoreManageAdapter :
    BaseQuickAdapter<StorehouseBean.ClassListBean, BaseDataBindingHolder<ItemStoreManageBinding>>(
        R.layout.item_store_manage
    ) {

    var maxNum = 0

    override fun convert(
        holder: BaseDataBindingHolder<ItemStoreManageBinding>,
        item: StorehouseBean.ClassListBean
    ) {
        holder.dataBinding?.progressbar?.let {
            it.max = (this.maxNum)
            item.stockNum?.let { it2 ->
                it.progress = it2
                it.secondaryProgress = it2
            }
        }
        holder.dataBinding?.apply {
            data = item
            executePendingBindings()
        }
    }

    val onItemClick: BindingCommand<Any> = BindingCommand(BindingConsumer {
    })
}